Moved list_ports to its own namespace (tools).

Pulled implementation into seperate source file.