Beginning of restructure using multiple threads to manage data and application state to clean up running.