updated for .net 4