es6 port; cleanup via Layer class