some tidy up, a start on testing