Implement automatic sorting of data.