more cleanup of functions