re #5 - improove locking and unlocking