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