Should probably be moved up top of the function with the other attributes that don't depend on other things.