Move variable parsing logic to external lib