Started adding sorting functionality