Updated resize method to take into account scale factor.