converted gregors files to c#
blah