Cleaned and streamlined best.R