syntax/format clean-up, use streams instead of temporary files