Uh, oh! Warnning! What if someone from outside setup "mode" already? If you don't assign default values (like "" empty), don't assume the variable is empty. Same applies to the others, but can easily be fixed by assigning them empty before.

Otherwise the patch looks good.

Sorry for the late reply, I'm a bit sick currently.