Fixed bug with clean_main, fixed issue with finding inactive ports, and removed accidental test code.
Fixed bug with clean_main, fixed issue with finding inactive ports, and removed accidental test code.

centip3de/GSoC,centip3de/GSoC,centip3de/GSoC