rework recursion and handle powers according to assumptions