cleanup and new routines