Ported to .net 4.0