Changed algorithm to recursive search because a full traversal is needed anyway to rule out mixing, and added more complex test case transactions.