Some modification to section 2.3 Dagger Algorithm