Renamed doInvoke to addFunctionToSelectedOwner.
Renamed typeDeclaration to classDeclaration.
Removed checking for null before instanceof.