modied addAttribute to swap and handle add and remove added remove from selected attributes