Changes to file initialization and try/except
use with for files
tuple unpacking ftw
todo: use key in max