Added loop to go through all sub pages