I made some minor improvements and fixed a few bugs concerning the locking mechanisms.