Added support for per-page searching.

Also fixed some small bugs.