Update onCommand to use the new update query function.