ADD: type class merging part of algorithm now, with type error detection. / MOD: shortened notation