Cleanup sorting JavaScript (use event delegation) and remove inline onclick events.