pages (part 2)

- add page count
- move code to page