added functionality to not get duplicate pages