rewrote ksCode::generateSplitCode fixes #7