Add state querying functionality