Let's just agree that this is better than the original?
The point of this pull is to fix some serious locking issues, not to change the code into a work of art.