changed data structure to namedtuple