Moved coverpage function up to come in before loop