Made the function that applied ratios more flexible.