Added domains for error handling in shutdown loops, removed q.