Update  template to a new port handling functions