refactor header mode to a separate flow