C# port of Stuart Warren's Logit project