further changes and addition of history management