begin to extract history manager
refactor to history manager
slight refactoring
refactor truncate to history manager
pass the history provider in
add 2 tests for edge cases