refactored connection count check; split out port counts