some bugs correction and refactoring all api controllers and the routes.