http://www.slab.org/whileoutput3