improvements in best.R