Fix #6 (and add example)

r? @tofumatt