Replaced arrays with lists.
Added a port argument option.
Removed some useless debug logging.