added edit method to controller