Lots of ugly messy fixes - transition phase towards getting the old unit tests to run