Refactored removing remote temporary files into a separate method