Re-implemented snap-to-page functionality