trying to create a better merging of all queries