Code cleanup & fixed bug with lock/unlock label.