pofbfs function added