working on first query function