code cleanup

- cleaned up all code
- annotated TODO's and NOTE's