Added port parameter

Rebased and squashed reverts made to #42. Closes #2.