Simplify the implementation

Using a channel-as-semaphore paradigm from [effective go](http://golang.org/doc/effective_go.html#channels).