Split splitAtLastIncompleteChar into two functions