Added an expandNode function