clean up the loading code