Rest refactor/tidy up