Optimize the upscale method