untested but complete best.R

Completed writing the code for best.R, but is currently untested.
Testing commencing after this commit.