Refactor addNode so that it can accept strings too

On the second thought it will be better to get this merged before whitespace fixes as it will produce conflicts.