Refactor internal port mappings