Moved the rep detection to the correct place