start rewriting on csharp