Refactor.
Refactored to use hash, rather than array.