untested and 1/2 finished implementation of opr calc using least squares