implemented handleHeaderState partly