Added dynamic generation of javascript