set up structure for the sorted method