completed compatibility with new api

further refinements + speed improvements required