implement locks

Signed-off-by: nixnodes <code@nixnodes.net>