use dict instead of array