Add the edit form and refactor the template