rework the resolve_server() functions and add some constants