Router refactoring

Moves router handling into its own module. There is single route method which adds route and if there was no route matching current fragment it checks the new one.