new way of equality and finally a solution to deal with library types
added debug messages
commented out type-dependent resolution for now