Refactor new and edit views