add ratio handling and functions