Added to 2dfold.c to support Depth First Search