using the readline write instead of writting directly to the stream