Converted

Finally converted it all from VB to C#