Added checkRatio function