make form serialize function more declaratively