Refactor make form function