Allow max_depth to be configurable and add a page_limit

* allow the max_depth to be configurable
* add a page_limit option