restructured algorithms