did some more refactoring. pulled out method for checking trials for repeat so I can do a unit test on it.