Clean up some functions