Fixed pagination, search and cleaned up/reorganized code. Refs #414