Fix/io handling

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