Lock file logic implemented