refactoring
refactoring
improved connection handling