Added useTempPath parameter to not use the temporary file