Doc enhancments and minor fixes

Fixed some typoes picked up by PHPStorm
Added some comments
Made all test pass.