Support for .net 4
Support for .NET 2.0
code cleanup
Fixed bug with ToArray