Chess: code improvements