Fixed route matching

Routes were being matched simply if they ended in a defined route - now
they have to match entirely.
More comments

Added some more comments to the code which builds the request data.