Cleanup Router:register method

- Move path parsing logic to seperate method so that is it unit testable
- Use `===` for string comparison for performance

Method name may be incorrect as I do not know full purpose of method.
Could be changed after this commit