add: maintain a proper history queue to move back and forward