Minor refactoring

The biggest change is that some internal classes (the memcache subclasses) have had their arguments changes around, but none of the public API has changed in any way.

The rest of the changes involved comment cleaning up and permission tweaks.