Adding code for page flipping.