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