adding comments, changing function and variable names, combining with midi_searching.py