Refactor restify helper