remove namedtuple, better comments and flow