Refactor REST API so that it is back into a single file