v2.0 move to C# from JScript