Updated server to handle query strings