Refactoring towards the new REST api structure