Changed all JS functions to use ES6 arrow functions