change to work with 1 or n nodes