better handling of routes / refactoring / cleaning a bit of code