Using namedtuple to simplify class definition.

@alexmuller, @phss