#19 added history as attribute and 2 functions to prepare for the loops