Refactored to allow for better test coverage

added tests for saving history
Added filter function to getHistory with tests