Added lock and unlock