Updated setup
Refactored locking mechanism (close #112)