Finsihed the edit button logic