Different write methods. But you're right that this block can be simplified by removing the == NULL checks.