Forgot to move variables into the function scope