implemented the print functionality