Using locks (instead of cache) for avoiding recursion.