Add action=edit and make unit tests more unit testy