Fixed logic for end direction