Fixes Issue #11
Merge pull request #12 from anasser/master

Fixes Issue #11 regarding locking.