Some refactoring + refactored and re-added router implementation