added lock
added locks and stuff