refactor and tidy based on nik code review

- fix typos
- extract methods
- window cleaning