?
added comments and a function to merge type kinds
rewritten 'validateFunctionPattern'