Modified to be more .NET compliant