Cleaned up agent stuff from server main loop.