query states cleanups
messages collecting logic
definition file fixes