Buffered reading
some improvements