Moved client script to another file and modified the demo.