Fixed #1.  Also added example application.