make it work for more than nodes