Add Clear function, and changed the internal data structure.