added port select code