yet more tweaks and removed old code