made the loop extraction into a function - we should move those
functions in main (that aren't main) to a different file/multiple
different files and keep main simple and dry....I'm going to make a
testing file right now for the cross-validation.