adding the sorting
need ned library
fixed