Some speed optimizations esp. for pinned piece detection.