Condense if-logic when checking whether top-level variable exists.
New behavior confirms variable creation prior to other functions being called.