Added the port as a config variable.
Merged with Mike's changes.