Changes:
- added comments, tidied up some code