refactor form parser