Cleanup code and alphabeta algorithm