add lock and unlock mechanism