Assign variables in function