`cnt` seems to be unused. Delete it. Move the declaration of `playerTids` up to the previous `var` block at the top of the function - read up on hoisting in JavaScript to see why I insist on this.