getPort function added