refactored use of new addStringVariable method to use previous method signature to reduce code duplication