move header mode into a separate script