modularized processing loop from keyboard input
 - mainly to improve visibility of profiling