Added Token class. Moved metadata handling to inside Token.