Made changes to accomodate numerator being bigger than denominator.