hoisted a few vars to fix per_page support