Remove extra BTreeMap and use hints for f64 type
Use numeric type casting for total