17: allow leading newlines and remove MAIN state