completed print function