update demo for new more-efficient encoding of functions