Added Collector interface and some modifications.