Updated do_costdivide for custom split