added query function to community