Use namedtuple and dictionary comprehensions