implementing header logic