added ugly code for printing