Clear up main-loop a bit