refactoring code for drawish endgames