adding javascript and tested it