changed namedtuples to classes