Refactored into separate class for clarity

CHG: moved all pagequery building/rendering functions into a separate
class; makes it much easier to understand the code.
CHG: moved toolbar listing into a \res folder
CHG: tiny change to show count symbol
CHG: lots of clean up, refactoring and line sorting