Code for sorts widget