Added support for locking