Added retention2 function.