defined a general display function