added states to certs and made some query changes