added collectWithHistory() method