Refactor route class, add tests