refactory form edit