Fix wrong var reference
Extract calendar data preprocessing