Improvements to discretization (using a postgresql extension for binning).