Seperated the javascript in the new example