The code has become pretty complex for merge, because we need to keep
track of indexes on branches, but we have something that compiles, runs
and produces results that doen't look crazy