Implemented header folding and added unit test for it