optimized player by avoiding repeated dom tree search