move code into new xresize func, add early exit to resize