Modified turn page function