private static void sortEvents(Score score, Vector evtList, Vector phrVct, SMF smf, Part part) {
        double startTime = 0.0;
        double[] currentLength = new double[100];
        Note[] curNote = new Note[100];
        int numOfPhrases = 0;
        double oldTime = 0.0;
        int phrIndex = 0;
        //Go through evts
        for (int i = 0; i < evtList.size(); i++) {
            Event evt = (Event) evtList.elementAt(i);
            startTime += (double) evt.getTime() / (double) smf.getPPQN();
            if (evt.getID() == 007) {
                PChange pchg = (PChange) evt;
                part.setInstrument(pchg.getValue());
                //if this event is a NoteOn event go on
            } else if (evt.getID() == 020) {
                TempoEvent t = (TempoEvent) evt;
                score.setTempo(t.getTempo());
            } else if (evt.getID() == 005) {
                NoteOn noteOn = (NoteOn) evt;
                part.setChannel(noteOn.getMidiChannel());
                short pitch = noteOn.getPitch();
                int dynamic = noteOn.getVelocity();
                short midiChannel = noteOn.getMidiChannel();
                //if you're a true NoteOn
                if (dynamic > 0) {
                    noteOn(phrIndex, curNote, smf, i,
                            currentLength, startTime,
                            phrVct, midiChannel,
                            pitch, dynamic, evtList);
                }
            } else if (evt instanceof TimeSig) {
                TimeSig timeSig = (TimeSig) evt;
                score.setNumerator(timeSig.getNumerator());
                score.setDenominator(timeSig.getDenominator());
            } else if (evt instanceof KeySig) {
                KeySig keySig = (KeySig) evt;
                score.setKeySignature(keySig.getKeySig());
                score.setKeyQuality(keySig.getKeyQuality());
            }
//                        else
//                        {
//                            System.out.printf( "Unused event: %o\n", evt.getID() );
//                            if( evt instanceof CChange )
//                            {
//                                CChange cChange = (CChange)evt;
//                                System.out.printf( "\tUnused event: %d\t%d\t%d\t%d\n",
//                                        cChange.getControllerNum(),
//                                        cChange.getMidiChannel(),
//                                        cChange.getTime(),
//                                        cChange.getValue() );
//                            }
//                            else if( evt.getID() == 027)
//                            {
//                                System.out.printf( "\tUnused event: %d\t%X\t%o\n",
//                                        evt.getTime(),
//                                        evt.getTime(),
//                                        evt.getTime() );
//                            }
//                        }
        }
    }