cleaned code in editcontroller