adding a method toggleNode