Various cleanup plus a fix for bug #33

Commit 9a6c9eb contains a bug fix to global rate limiting that others might find handy. The other commits are of marginal value to the main repo.

Credit for the bug fix goes to coworker Clayton Stangeland.