Broke off headers parser in function, it will be reused later.