improved print routine