cleanup and refactor to prepare for "always on" listen loop