demo online (http://csharppad.com/gist/11411005)