Fix a bug with wrongly selecting existing rects in d3

The d3 selectAll("rect") was selecting all rects, including the
background and upper left highlight rect and tried to update them.
To properly select only newly created rects, we use an empty
select, join it with the data and using enter().append() to obtain
a set of newly create rects to update.

We then update the rects accordingly with the joined data and
remove unecessary nodes (there shouldn't any but better be safe
than sorry).