Improved sorting speed, made classes for table stuff