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