Simplied the JS in the example