lots of tweaks and clean ups