Fix/io handling

- avoids clobbering str, id, and hash builtin functions
- using "with" statement to context guard IO
- consistent indentation
- avoids comparing to None singleton w/ == (use is instead)