Added repeat option (defaults to true, so this changes the function)