changed some js anti pattern to more best practice. changed behavior of intersect. if first or second set is undefined result set is not empty, it is the other set.