added is_main_query() check to address Issue #5