added support for deep refs

Added support for deep $refs by changing as little as possible...

Can now support models like:

    "Meh": {

    }

    "Bar": {
        "properties":{
            "Meh":{
              "$ref":"Meh",
            }
        }
    }

    "Foo": {
        "properties":{
            "Bar":{
              "$ref":"Bar",
            }
        }
    }