Code review

- reviewed the codebase
- renamed/reshuffled some stuff
- added code review comments