mostly adding comments and trying to make things more readable
added some tests for the router