* Added some comments to code and made it pretty

Signed-off-by: Tristan B. Kildaire <tristankildaire@gmail.com>