Added ability to specify a temporary directory