Implemented separate class for history management.