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