Replace array with a hash