more cleanup and tweaking