Removed variable from global scope
Better semantics
Readability
Readability
Simplified closure
Merge pull request #10 from gbbr/pool-c7

Some corrections
Changed counter to idCounter.
Added comment for idCounter.
Fixed comments.
changed the q variable to query and fixed comments.
Fixed comments.
Fixed comments.
Fixed variable name in anonymous function.