added NODF and sorting functions