minor tweak and clean up code