Add set var logic to main