Cleans up routing, adds unit tests, adds missing features