Major revisions to app generator, add permission, samples sub-generator