refractoring function in_day_of_week