Small cleanup.

Javadoc, moving of the Lock class, and removal of trailing spaces.