Section 31. Notwithstanding any general or special law to the contrary, the fees of the registers of deeds and of the assistant recorders, except as otherwise provided, to be paid when the instrument is left for recording, filing or deposit shall be subject to a surcharge of $5. The surcharge shall be imposed for the purpose of automation, modernization, operation and technological improvements at the registries of deeds. Only those registries under the control of the state secretary shall be subject to the terms and conditions of this section. From March 15, 2003, until June 30, 2016, all surcharges on fees collected pursuant to this section shall be forwarded to the Registers Technological Fund, established in section 2JJJ of chapter 29. From July 1, 2016, all of the surcharges shall be forwarded to the General Fund as provided in section 2 of said chapter 29.