Added srand(time(NULL)) and removed cerr's