cleaned up indentation
removed some old code
fixed a crash due to invalid node ids