Changed q generator so it doesn't add duplicates to the previous Q list