Updated traversal code to take a block that allows the user to block continued traversal of a branch. Tests extended to ensure new code works.