Updated connect.c to use convenience functions