move most logging out of control function