Fix nil per_page issue + a bit of a refactor of parsing logic