Need to declare finalizer for it to be called correctly