endrepeats fixed and removed from final output