Added temp-dir as configurable option.