Use "insertion sort algorithm" for trackEvents & Improve speed drawing lines