Extracted some common code from version repository.
Removed AgentHeisenbug annotations.
Major refactoring, part 1.
Major refactoring, part 2.