refactored class to work on all nodes