Convert code to ES6