refactored to a more elixir friendly style. also refactored to use host:port argument and improved the formatting of output.