Refactor mod/lock.
Merge pull request #384 from benbjohnson/refactor-mod-lock

Refactor mod/lock.