Make npm happy.
Add book locking in preparation for async operations, cleanup.