maybe you can coalesce the two lines by using `obj.toString()` (no need for the check) ?