Updated cleanup function in lsfphyml