added put statements
figured out the preprocessing steps needed to get the script to pass
some tidy up