Changed vector input to RAtoAi to a reference input, added alternative formulation but commented it out

significant speedup
Changed vector inputs into reference inputs in all places possible
Merge branch 'Ben's-Branch'