speed improvement of selection function
Merge branch 'origin/piechart_experimental'