logic for tweety