Added better threading and support for larger port range