update yagi / optimize yagi code