changed unlocked variable to boolean