Moved a lot of the code under /lib
Made some changes (like unsung a String for the template of generated files instead of reading them from disk) to be compatible with pub global run.