use es6 to improve code