Refactoring controllers, implementing a few API routes