Replaced fgets with getline