Added pagination, changed format to res.data and res.pagination