refactor to use restify instead of conntect