minor cleanup
converted to c#.