Adding sortNodelist function