Modified function such that the atom isn't used in the defaults.

This caused the routine to crash when the atom didn't have an icon or was null.
Tidy up and use more sane defaults.