rescale code