tweaking some query performance stuff