refactor wtm_pagination