use hash instead of array to improve performance