First attempt on lock functions