process and handleServerResponse functions