Added embedded javascript (not polished)