refactor xh_resize