small structure change
implemented nodecounting, yet to be debugged