Working on the splitting logic
Improving splitting logic