Update javascript and removed unused code