srand(time(0)) is only called once now and removed debug prints.