use hash instead of array