Implementing readline method