Cosmetic changes and comments
Added comments
Made Generator suitable for unit testing