first draft of form handling, not quite working yet