Switched getType() to instanceof