refactoring code for drawish endgames 2