changed from routes to controllers and did some refactoring