- added more comments to the code.
- minor improvements.