added inner-outer with switch to power iteration