move some logic to form factory