use _.forEach instead of for(… in
Take other properties into account when deduplicating

…not just d but d and width (for now)