move imports to headers
fixed indentation and formatting in elses
changed to use syntax sugar for dict methods
notes and formatting, small refactor