Added is_day function