Cleaned up connection logic.