remove duplicate pagination code