updated snippet for new page handling.