Refactoring

> Originally at https://github.com/kevin-brown/mousetrap/pull/1

This is the pull request that will be used for code review, tracking progress, and eventually generating the patch set for this refactoring.