NEED TO REFACTOR CLIENT CONNECTION