[TASK] Use instanceof comparison instead of string comparison