Improve upgrade template