removed promise from query function