now using a dict instead of a list