Add function to determines ports