cleaned up javascript of unnecessary code