Move variable outside of function