formats output correctly