Updated javascript structure