solved some bugs, added a description of the union algorithm used, added some details about sanity checks