add support for ratios

Possible division by 0 here.