refactor setup_webi in terrain