Added logic for folding Received headers and added unit tests