updated to allow multiple connections