Reuse temporary files (fixes #4)
Add tests