Reduced the number of membership queries