added query mode