Code in almost working state. Need to modify to read in full program