refactored count nights
refactored count nights
refactored count nights
refactored count nights and callendar