Overall refactoring. Started the implementation of unionWith.
Implemented unionWith.
Minor changes.