factor program generation
factor main_loop
Merge branch 'mergemain'

* mergemain:
  factor main_loop
  factor program generation