added history implementation and tests