Made the Validator class self contained.
Now, JSON Editor fully resolves all references before initialization.
Added more validation test cases for $ref and definitions.
Cleaned up the code.