added lock mechanism