Fix code comments
Remove duplicate comments already in the header file
Improve internal file_lock class

Fix and expand comments, and make the code flow run without assertions.