Replace recursive search and destroy with a simple while loop;
adding parity and weighting