Refactor edit route.