Add ability to use a custom temp directory.