refactor some code
refactor some code

* replace the calls to api.reigster_node() with the method `new_node()`. This
* removes some repeated code since the api call was like 4 lines each.

CCI-MOC/haas,SahilTikale/haas