Implements history back and forward.