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