Clean up port handling code
Merge branch 'rhc-master' into rhc-issue-chat