print function revised