Group similar records with JS

A continuation of #553, now issued against the `2.0.0` branch.

Resolves #516