Refactoring the edit template and mousetrap interactions.