update merging code to cope with initialization
new code for splitting