Made some changes to edit method