finished 3 functionalities of history. need to test well, and add comments.