Switching to continuation passing style for the main game loop to facilitate synchronous I/O