fleshed out mainapp.py while loop structure