restructured some recursions