flownav: a few performance tweaks to the main loop.