major shifting around of code to clearly separate code into subroutines and "main...