Small API changes, game loop code and AI