moved some more locking routines to locking.c, and moved replacement