Leverage array.index instead of looping through

Proposing some refactoring, no new features - all tests still pass code is just a bit more compact.