format code, add PortScan utility and unit test.