Refactor Edit template