More tests and ES6 refactorings