fixed sorting/selectedIndex bug, more docs