More rest functionality, code cleanup