move history loading in diff to its own function