factored out player id fetching. added caching for players to reduce number of sql statements.