i want to keep the variables to use later
Like I mentioned before, the variable you create in this function have 0 effect anywhere else. Just return all data, and assign them to variables at the callsite like I showed.