Refactor cluster code to match with new node.js Cluster API