Added ability to specify cache directory