clean up some code, adjust delays