split sorter() to sorter() and getShortestColor()