added logic of types uniting
added logic of types uniting