updated addClass to avoid unnecessary duplication and redraw