rework print function