Refactoring form code on client side.