Trail optimization