overhauled library and removed kludgy, fiddly, self-maintained OO implementation