Split main() from generator methods