implement print function