implementing a print function