Now using the '==' and '!=' operators instead of instanceof and getClass().