restructuring and a few core tweaks