BUG (fixed): program would immediately quit, added while loop with terminate options)