minor tweaks and restructuring