completed the balance split function.