Updated a couple Javascript functions