Made simple query function to remove duplicate processes