Proper lock feature

Working lock feature - however occasionally doesn't work first time