please refactor this and the init method so that the port arg comes before `exitCb`