Reorg generator code to keep flask app code clean