Remove unneeded functions.
Reference `is_instance` through `r`.
Reduce the scope visibility of connection objects.