write a more general Block output function