Added tests to read method.
Added proper headers end detection.