started writing lock functionality