Reformat the connection query