Optimized code a little bit by performing less get node names