Put together bulk of program. Still have to figure out how to decide which operation needs to be performed for current iteration.