code clean-up and tweaks