refactor forms code and finist part 3