Replaced all is_a() calls with instanceof operator