Refactor imagemap search, fix page count bug