added support for multiple pages