Changed the rep function