Adding instanceof support, and fixes
Instanceof + casts working