Added support for subclasses in connect