Various little fixes

* better URL matching;
* move docstrings where they belong;
* consistent string formatting;
* shorter incrementing statements.