convert more scripts to c#