Updated fetch_remote_file function to allow for optional parameters.