Chess: refactoring