Update to fix andrew's suggestion and a few other tweaks