cleaning up and consolidating algoTwo