changed port function