Fix logging
Refactoring of routing