previous rep is passed as parameter