cleaning up some functions