Add logic for empty header and tests