Refactor; use .NET classes where possible

Are you ever passing `$remainingArgs` as strings here?