move output functions into a separate class