Handle some errors better. Use separate temp and output directories so we can run multiple threads at once