Fixed broken Tests
Refactored ContextHistory to remove big bug and other minor refactorings