add history-expand and its test cases
separate example from test
remove redundant code
find exactly required header file