changed some printing functions to be more general