Lowered the line count to under 78

made changes to move one time used variables into error catching if statement