function for connections