Changed getline function to mgetline