add example code from issue #372