Add port number option
better error handling