Made refactoring of ChessEngine.