restructured node back-end for better modularity