My sample code on github.