Fixed attribute caching bugs in BasicSchemaExtraction.
(See bottom of mergeWithSchema() function).

In addition, some variable names and function signatures
are changed to be more intuitive.