Added more logic to edit/add item overlay