Cleanuped and refactored router code. Added comment. Added loggers, possibility to change it.