Changed to a class method--it deals only with class-level data.  It also shortens the text in the function.