Tidy up functional test, split out helper methods