implemented action queries and improved state queries