Refactoring on removeSinglechildNode method to remove the target argument