He went to China in 1885, and served as an advisor to the ranking official Zhang Zhidong for twenty years.