added ratio code - incomplete