Refactor; use .NET classes where possible

There should be better ways. Need to do some research, though. :-)