[PATCH 4/4] doRemoteOpen: Refactor control flow