update code and add a demo