Code for selecting best STs