Improved usage of $wpdb for tables in queries.