Move locks to critical section