make split_string tail-recursive