Rewritten with new interface.