Fix bad port names, move all removals to the top of the script