Replace uses of seq with
DRY in union
Use a single IntMap instead of 2 to avoid superfluous lookups and a more descriptive data type