Move variable expansion into preprocessing stage