Finish test writing and bugfixing
rewrite test to use temp file rather than string (for more realistic usage)