Added pagination. Last commit before converting to Postgres