Code from http://blog.golang.org/pipelines