remember currently edited form at end of history; refactor to minimize use of state and improve readability