Implementation of print functionality