move pretty table printing into a function