updated to take port as an argument (in order to work with modified Hail class)