C#: Made distance bug fixes from Java code.
C#: Fixed ESS to be SSE