Reworking class.js plugins into a functional style