Improved the history management to support forward as well