Refactored the lock system a little - much better now