Minor internal refactoring and renamings

Noticed that I’ve used CPS for handleWriteRequest, so be explicit in the
name of things. Define an explicit type, since that seems like
self-documenting code.