Part way through fixing the tests