added ability to set port number in preferences