chess modification/code refactored