Move EndgameFunctions to endgame.cpp