Added snippet of code to manage locking button