Added missing space for "pattern" attribute error.
Refactored path/$ref resolution. Added support for $ref in "extends" property.