this was breaking current functionality
removed
write to tmp, use three args
various changes to make testing easier, document thanks, etc