cleanup
rearranging the flow of the algorithm so that it is more efficient.