[CLEANUP]
- Added copyright headers and some comments.
[CLEANUP]
- Comments and minor refactoring.