Tweaked for performance

Multiple locks