Initial work on lock cleanup
Cleanup lock
Merge pull request #1642 from pveentjer/cleanup/lock3

Cleanup/lock3