added implementation of getline