created basic query function