implemented the print subroutine