Updated the tag query to handle spaces