added connections
code reorganization