scripts converted to c#