Adding locking mechanism.