added global variable for 'ratio'