implemented query and server