refactoring
started to revise merging of types (not yet finished)