Bit more refactoring at rest endpoint