revise the codes to fit in deleting the ports