updated print function