modified javascript amazing2 blog