updated to receive host and port