Refactor usage of tmpFilePath