- add logging
- also make max page length configurable