turn an array lookup to hash lookup