Removed dump_export_definitions as this is actually application-specific.
For diagnostic purposes, added $q_fields to collect all fields used in q's.