add table sorting functionality