Make use of streams

Fixes #6.