rough rework of the library for use in Continuum and generally for ES6