Implements the density scoring.