translated to C# for readers