Updated JavaScript, improved style