For better readability: change variable $q to $query, and match with other query string