I'd remove str here and only declare it as a variable inside the function as it is not used.