logic for end