Merged two port getting functions "getPort()" and "init()"