Probably worth setting these vars immediately on lines 104 & 105 so these lines can be removed.