Moved function to get node units into model.js
Some cleanup of minor bugs.