Before the algorithm for history view
History Function