break up long lines
fix imports
fix imports
improve formatting
break up long lines
factor out cut-n-paste duplicated function
reorg exception handling / spacing
add missing import
tidy up error reporting
fix redundant iterator
tidy up error reporting