Renamed and put game loop in thread