added print functionality and tests