(http://csharppad.com/gist/10856612)