Replaced underscore sort with d3 sort, cosmetic changes.