leave credit logic