Rewrote the pages class, and how it is used by other classes