refactored main handler loop, broke session teardown in its down func