Working version of the first 5 steps. Needs some code consolidation and cleanup of the results file, but it is buged checked and working.