Refactor; use .NET classes where possible

Ah, yes, you are absolutely right. That's a mistake in the code.