Fixed calculations and groundwork for sortable columns