much work done, much copied from generator-generator
fixin merge conflicts