cleanup, conversion to OO lib