add line to check that input file exists, add better exception handling generally
add line to check that input file exists, add better exception handling generally