some cleanup and tweaks