wrote the fuild_rescale function