reimplemnt oobgc algorithm