now solves for i.
WIP
fixed merge conflicts