Fix #7 - Forgot that PREFIX=(...) lists in descending order. Reverse the order of prefixes then compare indices