add form handling and tests for it