read_remote_file in a function