New implementation of getline