Changes to allow sample to run in Chrome and fix JS errors